package cn.wolfcode.brand.service.impl;

import cn.wolfcode.brand.domain.Brand;
import cn.wolfcode.brand.mapper.BrandMapper;
import cn.wolfcode.brand.query.BrandQueryObject;
import cn.wolfcode.brand.service.IBrandService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;


@Service
public class BrandServiceImpl extends ServiceImpl<BrandMapper, Brand> implements IBrandService {

    //分页实现
    @Override
    public Page<Brand> queryPage(BrandQueryObject qo) {
        //1. 创建一个page对象
        Page<Brand> page = new Page<>(qo.getCurrentPage(), qo.getPageSize());
        //创建一个查询对象的构造器 加条件 可以不需要
        QueryWrapper<Brand> queryWrapper = new QueryWrapper<>();
        return super.page(page, queryWrapper); //返回的就是Page
    }
}